package com.lzgcoding.onlineshopapp.room.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.lzgcoding.onlineshopapp.room.entity.ItemEntity

@Dao
interface ItemDao {
    @Query("SELECT * FROM Items")
    suspend fun getAll(): List<ItemEntity>

    @Query("SELECT * FROM Items WHERE id = :id")
    suspend fun getItemById(id:Int): ItemEntity?

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertAll(items: List<ItemEntity>)
}